package net.stogi.unicore.beyond.ui.client.taskrunner.taskinstance;

import net.stogi.unicore.beyond.api.model.TaskDefinition;

import com.google.gwt.event.shared.GwtEvent;

public class OpenTaskInstanceEvent extends GwtEvent<OpenTaskInstanceHandler> {

	public static final GwtEvent.Type<OpenTaskInstanceHandler> TYPE = new GwtEvent.Type<OpenTaskInstanceHandler>();

	private TaskDefinition taskDefinition;

	public OpenTaskInstanceEvent() {}

	public OpenTaskInstanceEvent(TaskDefinition taskDefinition) {
		this.taskDefinition = taskDefinition;
	}

	@Override
	public Type<OpenTaskInstanceHandler> getAssociatedType() {
		return TYPE;
	}

	/**
	 * @return the taskDefinition
	 */
	public TaskDefinition getTaskDefinition() {
		return taskDefinition;
	}

	/**
	 * @param taskDefinition
	 *          the taskDefinition to set
	 */
	public void setTaskDefinition(TaskDefinition taskDefinition) {
		this.taskDefinition = taskDefinition;
	}

	@Override
	protected void dispatch(OpenTaskInstanceHandler handler) {
		handler.onOpenTaskInstance(this);
	}
}
